<template>
  <a-drawer
    width="60%"
    title="客户签约"
    :label-col="4"
    :wrapper-col="14"
    :visible="open"
    :body-style="{ height: 'calc(100vh - 100px)', overflow: 'auto' }"
    @close="cancel"
  >
    <a-form-model ref="form" :model="form" :rules="rules" layout="vertical">
      <a-spin :spinning="spinning" :delay="delayTime" tip="Loading...">
        <a-row
          :gutter="32"
          style="width: 80%; margin-left: 15%; margin-top: -10px"
        >
          <a-col :span="24" style="margin-left: -120px; margin-bottom: 15px">
            <div style="display: flex; flex-direction: row">
              <span
                style="
                  width: 5px;
                  height: 22px;
                  background-color: coral;
                  display: block;
                "
              ></span>
              <span
                style="
                  margin-left: 5px;
                  height: 22px;
                  line-height: 22px;
                  font-size: 16px;
                  font-weight: 600;
                "
                >进件信息</span
              >
            </div>
          </a-col>

          <a-col :span="8">
            <a-form-model-item label="服务机构" prop="orgType">
              <a-select
                placeholder="请选择服务机构"
                v-model="form.orgType"
                :getPopupContainer="
                  (triggerNode) => {
                    return triggerNode.parentNode || document.body;
                  }
                "
                style="width: 100%"
                allow-clear
                @change="handleGetProductInfo"
              >
                <a-select-option
                  v-for="(d, index) in orgTypeOptions"
                  :key="index"
                  :value="d.dictValue"
                  >{{ d.dictLabel }}</a-select-option
                >
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="产品名称" prop="productId">
              <a-select
                placeholder="请选择产品"
                v-model="form.productId"
                :getPopupContainer="
                  (triggerNode) => {
                    return triggerNode.parentNode || document.body;
                  }
                "
                style="width: 100%"
                allow-clear
                @select="handleChooseProduct"
              >
                <a-select-option
                  v-for="d in productList"
                  :key="d.productName"
                  :value="d.id"
                  >{{ d.productName }}</a-select-option
                >
              </a-select>
            </a-form-model-item>
          </a-col>

          <a-col :span="8">
            <a-form-model-item label="进件类型" prop="jinjianType">
              <a-select
                placeholder="请选择进件类型"
                v-model="form.jinjianType"
                :getPopupContainer="
                  (triggerNode) => {
                    return triggerNode.parentNode || document.body;
                  }
                "
                style="width: 100%"
                allow-clear
              >
                <a-select-option
                  v-for="(d, index) in jinjianTypeOptions"
                  :key="index"
                  :value="d.dictValue"
                  >{{ d.dictLabel }}</a-select-option
                >
              </a-select>
            </a-form-model-item>
          </a-col>

          <a-col :span="8">
            <a-form-model-item label="客户姓名" prop="customerName">
              <a-input
                v-model="form.customerName"
                placeholder="请选择客户"
                disabled
                @search="handleOnSearchCustomer"
              >
              </a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="身份证号码" prop="idCard">
              <a-input v-model="form.idCard" placeholder="自动获取" disabled />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="电话" prop="phone">
              <a-input v-model="form.phone" placeholder="请输入电话" />
            </a-form-model-item>
          </a-col>
          <a-col :span="24" style="margin-left: -120px; margin-bottom: 15px">
            <div style="display: flex; flex-direction: row">
              <span
                style="
                  width: 5px;
                  height: 22px;
                  background-color: coral;
                  display: block;
                "
              ></span>
              <span
                style="
                  margin-left: 5px;
                  height: 22px;
                  line-height: 22px;
                  font-size: 16px;
                  font-weight: 600;
                "
                >贷款信息</span
              >
            </div>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="申请金额（元）" prop="yxEdu">
              <a-input-number
                v-model="form.yxEdu"
                :min="0"
                style="width: 100%"
                placeholder="请输入申请金额（元）"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="签约金额（元）" prop="sjEdu">
              <a-input-number
                v-model="form.sjEdu"
                :min="0"
                style="width: 100%"
                placeholder="请输入签约金额（元）"
              />
            </a-form-model-item>
          </a-col>

          <a-col :span="8">
            <a-form-model-item label="还款方式" prop="backType">
              <a-select
                placeholder="请选择还款方式"
                v-model="form.backType"
                :getPopupContainer="
                  (triggerNode) => {
                    return triggerNode.parentNode || document.body;
                  }
                "
                style="width: 100%"
                allow-clear
              >
                <a-select-option
                  v-for="(d, index) in backTypeOptions"
                  :key="index"
                  :value="d.dictValue"
                  >{{ d.dictLabel }}</a-select-option
                >
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="月供金额（元）" prop="monthAmount">
              <a-input-number
                v-model="form.monthAmount"
                :min="0"
                style="width: 100%"
                placeholder="请输入月供金额（元）"
              />
            </a-form-model-item>
          </a-col>

          <a-col :span="8">
            <a-form-model-item label="分期时间（月数）" prop="fenqiTime">
              <a-input-number
                v-model="form.fenqiTime"
                :min="0"
                style="width: 100%"
                placeholder="请输入分期时间（月数）"
              />
            </a-form-model-item>
          </a-col>

          <a-col :span="8">
            <a-form-model-item label="签单时间" prop="qiandanTime">
              <a-date-picker
                v-model="form.qiandanTime"
                valueFormat="YYYY-MM-DD"
                :show-today="true"
                placeholder="选择日期"
                style="width: 100%"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="客服" prop="servcieUserName">
              <a-input
                v-model="form.servcieUserName"
                placeholder="请选择客服"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="服务费用" prop="serviceAmount">
              <a-input-number
                v-model="form.serviceAmount"
                :min="0"
                style="width: 100%"
                placeholder="请输入服务费用"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="费用备注" prop="serviceAmountRemark">
              <a-input
                type="textarea"
                v-model="form.serviceAmountRemark"
                placeholder="请输入费用备注"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="24" style="margin-left: -120px; margin-bottom: 15px">
            <div style="display: flex; flex-direction: row">
              <span
                style="
                  width: 5px;
                  height: 22px;
                  background-color: coral;
                  display: block;
                "
              ></span>
              <span
                style="
                  margin-left: 5px;
                  height: 22px;
                  line-height: 22px;
                  font-size: 16px;
                  font-weight: 600;
                "
                >其他信息</span
              >
            </div>
          </a-col>
          <a-col :span="5">
            <a-form-model-item label="是否GPS安装" prop="isGps">
              <a-radio-group v-model="form.isGps" button-style="solid">
                <a-radio-button value="0"> 待安装 </a-radio-button>
                <a-radio-button value="1"> 已安装 </a-radio-button>
              </a-radio-group>
            </a-form-model-item>
          </a-col>
          <a-col :span="7">
            <a-form-model-item label="抵押状态" prop="diyaStatus">
              <a-radio-group v-model="form.diyaStatus" button-style="solid">
                <a-radio-button value="未抵押"> 未抵押 </a-radio-button>
                <a-radio-button value="抵押中"> 抵押中 </a-radio-button>
                <a-radio-button value="已抵押"> 已抵押 </a-radio-button>
              </a-radio-group>
            </a-form-model-item>
          </a-col>
          <a-col :span="7">
            <a-form-model-item label="备用钥匙" prop="beiyongKey">
              <a-radio-group v-model="form.beiyongKey" button-style="solid">
                <a-radio-button value="不需要"> 不需要 </a-radio-button>
                <a-radio-button value="无备用"> 无备用 </a-radio-button>
                <a-radio-button value="有备用"> 有备用 </a-radio-button>
              </a-radio-group>
            </a-form-model-item>
          </a-col>
          <a-col :span="5">
            <a-form-model-item label="服务合同" prop="hetongQianshu">
              <a-radio-group v-model="form.hetongQianshu" button-style="solid">
                <a-radio-button value="未签署"> 未签署 </a-radio-button>
                <a-radio-button value="已签署"> 已签署 </a-radio-button>
              </a-radio-group>
            </a-form-model-item>
          </a-col>
          <!-- <a-col :span="8">
            <a-form-model-item label="资料回寄" prop="ziliaoBack">
              <a-radio-group v-model="form.ziliaoBack" button-style="solid">
                <a-radio-button value="未回寄"> 未回寄 </a-radio-button>
                <a-radio-button value="已回寄"> 已回寄 </a-radio-button>
              </a-radio-group>
            </a-form-model-item>
          </a-col> -->
        </a-row>
      </a-spin>
      <div class="bottom-control">
        <a-space>
          <a-button type="primary" @click="submitForm"> 保存进件 </a-button>
          <a-button
            type="primary"
            @click="handleJinjianShenhe('8')"
            style="background-color: orange; border-color: orange"
          >
            确认签约
          </a-button>
          <a-button @click="cancel" type="danger"> 取消 </a-button>
        </a-space>
      </div>
    </a-form-model>
  </a-drawer>
</template>
<script>
import BizJinjianInfoEditForm from "./BizJinjianInfoForm";
export default {
  ...BizJinjianInfoEditForm,
};
</script>
